#------------------------------------------------------------------------------
# MyProject
# 
# Copyright (c) ShenYongchen (shenyczz@163.com)
# All rights reserved.
# 
#------------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)

# 策略
foreach(policy CMP0068 CMP0071 CMP0083)
  if(POLICY ${policy})
    cmake_policy(SET ${policy} NEW)
  endif()
endforeach()


# 设置项目名称和版本
project(MyProject VERSION 1.0)

# 指定C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# 设定其他参数
set(nvtx3_dir "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/include/nvtx3")
# set(CUDA_nvrtc_LIBRARY "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.6/bin/nvrtc64_120_0.dll")

# CUDA / CUDAToolkit
# find_package(CUDAToolkit REQUIRED)
# message(STATUS "CUDA_LIBRARIES: ${CUDA_LIBRARIES}")
# message(STATUS "CUDA_INCLUDE_DIRS: ${CUDA_INCLUDE_DIRS}")

# CUDNN
# D:\Programs\mybin\nvidia\cudnn_cuda12\v9.10.0
# set(CUDNN_ROOT "D:\\Programs\\mybin\\nvidia\\cudnn_cuda12\\v9.10.0")
# set(USE_CUDNN ON CACHE BOOL "Use cuDNN support.")
# set(USE_NVTX OFF CACHE BOOL "Disable NVTX support")  # 禁用 NVTX 避免警告
# set(USE_NVTX OFF CACHE BOOL "Disable NVTX support")  # 禁用 NVTX 避免警告

# LIBTORCH
set(LIBTORCH_ROOT "D:\\Programs\\mybin\\libtorch\\2.6.0")
list(APPEND CMAKE_PREFIX_PATH ${LIBTORCH_ROOT})
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")

# 如果使用其他库，可以在这里添加
# find_package(Boost REQUIRED)


if(MSVC)
    # add_compile_options(/W0) # 禁用所有警告
    # 禁用特定警告
    add_compile_options(/wd4267 /wd4530 /wd4996)
    # add_compile_options(/EHsc)
    # add_compile_options(/utf-8 /EHsc)
endif()
#------------------------------------------------------------------------------
# 选项
# option(USE_NVTX "Use nvtx3." OFF)
#------------------------------------------------------------------------------
# 查看一些变量
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
message(STATUS "TORCH_LIBRARIES: ${TORCH_LIBRARIES}")
message(STATUS "TORCH_INCLUDE_DIRS: ${TORCH_INCLUDE_DIRS}")
#------------------------------------------------------------------------------
# 设置全局包含目录
# include_directories("your path/include")

# 设置全局链接目录
# link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY})

# 添加子目录 (先库后应用)
add_subdirectory(sfx-libs/mylib)
add_subdirectory(sfx-libs/mylib2)
add_subdirectory(apps/radar)
add_subdirectory(apps/torch_test)
#------------------------------------------------------------------------------
